# -*- coding: utf-8 -*-
# @Date   : 2019/11/8
# @File   : EC10_DataIsNull.py
# @Author : Cyril

'''eof
name:企业征信数据是否异常
code:EC10_DataIsNull_2D
tableName:
columnName:
groups:企业征信模块
dependencies:EC_DSJ_2D
type:常用指标
dataSourceType:在线指标
description:
eof'''

import sys
import re


reload(sys)
sys.setdefaultencoding('utf-8')

null_type_list = ['', ' ', None, 'null', 'Null', 'NULL', '/', '-', '--']

def getTable(data, tableName, occurTimes):
    '''
        获取表信息
        :param data:表上层的字典对象
        :param tableName:表的名字
        :param occurTimes:表出现的次数，如果是0代表此表可以不出现，如果是1代表此表必须出现
        :return:该表全部数据
        '''
    table = data.get(tableName)
    if occurTimes == 0:
        if table is None:
            return [{}]
        elif isinstance(table, list) is False or len(table) == 0:
            return None
        else:
            return data.get(tableName)
    if occurTimes == 1:
        if table is None or isinstance(table, list) is False or len(table) == 0:
            return None
        elif len(table) == 0:
            return [{}]
        else:
            return data.get(tableName)

# def EC10_DataIsNull():
#     '''判断ECRSummaryDesc 表中 ReportNo  是否缺失'''
#     try:
#         ECRSummaryDesc = getTable('ECRSummaryDesc')
#         if ECRSummaryDesc is None:
#             raise Exception(u'企业征信数据ReportNo不存在')
#         else:
#             if ECRSummaryDesc[0].get('ReportNo') in null_type_list:
#                 raise Exception(u'企业征信数据ReportNo不存在')
#             else:
#                 return 0
#     except:
#         raise Exception(u'企业征信数据ReportNo不存在')

def EC10_DataIsNull():
    return 0


result = ()
